package task3_4new;



public class Doctor {
String name;
int patientcount;
Patient[] patientnames;
int maxpatient;

public Doctor(String name,int maxpatient){
	this.name=name;
	this.patientcount=0;
	this.maxpatient=maxpatient;
	this.patientnames=new Patient[maxpatient];
}
 public Doctor recordtodoctor(Patient pat){
	 if(this.patientcount<this.maxpatient){
		 this.patientnames[patientcount] =  pat;
		 this.patientcount++;
	 }
	return this;
 }

 public Doctor cancelrecordtodoctor(Patient pat){
	 for (int i=0;i<this.patientcount;i++)
	 {
	 if(this.patientnames[i].name.equals(pat.name)){
		 this.patientnames[patientcount] =  null;
		 this.patientcount--;
	 	}
	 }
		 return this;
 }
 public  void showpatientrecords(){
	 
	System.out.printf("Count of records to %s is %d",this.name,this.patientcount);
	 
 }
}
